package it.polimi.entities.web;

import it.polimi.entitiesDTO.AirportDTO;
import it.polimi.entitiesManagers.TransportMgr;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name="AirportBean")
@RequestScoped
public class AirportBean {

		
		@EJB
		private TransportMgr tMgr;

		private AirportDTO airportDTO;
		
		public AirportBean() {
			this.airportDTO = new AirportDTO();
		}

		public AirportDTO getAirportDTO() {
			return airportDTO;
		}

		public void setAirportDTO(AirportDTO airport) {
			this.airportDTO=airport;
		}
		
		public String register() {
			tMgr.save(this.airportDTO);
			return "/admin/index";
//index?faces-redirect=true
		}
}
